<script setup lang="ts">
import {computed, inject, ref, watch} from "vue";
import {Message} from "@arco-design/web-vue";
import MaInfo from "@/components/ma-info/index.vue"
import dictHelp from "@/utils/dicthelp.js";

const config = inject('config')
const record = ref({})
const visible = ref(false)
const onShow = async (data) => {
  record.value = data
  visible.value = true
}
const infoColumns = ref([
  {
    title: "出货单号",
    dataIndex: "id",
    formType: "input",
  },
  {
    title: "发出时间",
    dataIndex: "send_date",
    formType: "date",
    showTime: true
  },
  {
    title: "类型",
    dataIndex: "type",
    formType: "select",
    dict:{
      data:[
        {label: "大货",value: "1"},
        {label: "包裹",value: "2"}
      ],
      translation: true
    },
  },

  {
    title: "箱数",
    dataIndex: "volume_weight.parcel_count",
    formType: "input",
  },
  {
    title: "发出站点",
    dataIndex: "from_depot_id",
    formType: "select",
    dict: {
      url: 'warehouse/depot/list',
      props: {label: 'name', value: 'id'},
      translation: true,
      params: {
        select: 'id,name',
      }
    },
  },
  {
    title: "发往站点",
    dataIndex: "to_depot_id",
    formType: "select",
    dict: {
      url: 'warehouse/depot/list',
      props: {label: 'name', value: 'id'},
      translation: true,
      params: {
        select: 'id,name',
        delivery:true,
      }
    },
  },
  {
    title: "状态",
    dataIndex: "status",
    formType: "select",
    dict: {
      name: "DeliveryStatus",
      props: {
        label: "title",
        value: "key"
      },
      translation: true
      },
  },
  {
    title: "重量",
    dataIndex: "volume_weight.weight",
    formType: "input",
  },
  {
    title: "体积/泡比",
    dataIndex: "volume_weight.ratio",
    formType: "input",
  },
  {
    title: "体积比",
    dataIndex: "volume_weight.volume_ratio",
    formType: "input",
  },
  {
    title: "主品名",
    dataIndex: "name",
    formType: "input"
  },
  {
    title: "接收时间",
    dataIndex: "get_date",
    formType: "date",
    showTime: true
  },
  {
    title: "单独清关",
    dataIndex: "clearance",
    formType: "switch",
  },
  {
    title: "出口报关",
    dataIndex: "declaration",
    formType: "switch",
  },
  {
    title: "标识",
    dataIndex: "tags",
    dict:{
        url: 'logistics/tag/list',
        props: {label: 'name', value: 'id'},
        params: {select: 'id,name',type:3},
        translation: true,
    },
    formType: "select"
  },

  {
    title: "分货备注",
    dataIndex: "distribut_mark",
    formType: "input",
  },
  {
    title: "参考号",
    dataIndex: "reference",
    formType: "textarea",
    hide:true
  },
  {
    title: "供应商服务",
    dataIndex: "supplier_service_id",
    formType: "select",
    virtualListProps:{},
    dict: {
          url: 'logistics/supplier/list',
          props: {
              label: 'name',
              value: 'id'
          },
          translation: true
        },
    search: true,
    hide:true
  },
  {
    title: "创建者",
    dataIndex: "created_by",
    formType: "select",
    dict: dictHelp.user,
  },
  {
    title: "创建时间",
    dataIndex: "created_at",
    formType: "date",
    showTime: true
  },
  {
    title: "备注",
    dataIndex: "remark",
    formType: "textarea",
    hide: true,
  }
])
defineExpose({onShow})
</script>
<template>
    <a-drawer title="#提单详情" v-model:visible="visible" width="100%" v-if="visible" unmount-on-close :footer="false">
        <a-space direction="vertical" class="w-full">
            <ma-info :columns="infoColumns"  column="1" layout="horizontal"  :data="record"  size="small" :bordered="false"/>
        </a-space>
    </a-drawer>
</template>

<style scoped>

</style>